<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
	*{
		padding: 0;
		margin: 0;
	}
	#tab{
		width: 600px;
		height: 500px;
		border: 2px solid blue;
		margin: 10px auto;
		position: relative;
	}
	#tab ul li{
		float: left;
		list-style: none;
		width: 200px;
		height: 50px;
		line-height: 50px;
		text-align: center;
		font-size: 30px;
		font-family: 微软雅黑;
		color: white;
	}
	#tab .con{
		width: 580px;
		height: 430px;
		position: absolute;
		top: 60px;
		left: 10px;
		display: none;
	}
	#tab .box{
		width: 200px;
		height: 10px;
		background: purple;
		position: absolute;
		top: 50px;
		left: 0px;
	}
</style>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript">

$(function(){

	$('#tab ul li').mouseover(function() {
		// 获得移入的li的序号
		var c  = $(this).index();
		// 让c号con显示，其他的隐藏
		$('#tab .con').eq(c).show().siblings('.con').hide();
		// 计算小滑块的位置
		var left = c*200;
		// 让小滑块移动过来
		$('#tab .box').stop().animate({'left':left+'px'}, 300)
	});


})


</script>
</head>

<body>

<div id="tab">
	<ul>
		<li style="background:#22B14C;">新闻</li>
		<li style="background:#00A2E8;">体育</li>
		<li style="background:#FF7F27;">娱乐</li>
	</ul>
	<div class="con" style="background:#22B14C;display:block;"></div>
	<div class="con" style="background:#00A2E8;"></div>
	<div class="con" style="background:#FF7F27;"></div>
	<div class="box"></div>
</div>

</body>
</html>
